package com.huang825172.sbog.Util;

import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

//实现沉浸式的helper
public class SystemUIControler {
    private Window _window;
    private WindowManager.LayoutParams params;

    public SystemUIControler(AppCompatActivity activity) {
        this._window = activity.getWindow();
        this.params = _window.getAttributes();
    }

    public void hideSystemUI() {
        params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE;
        _window.setAttributes(params);
    }

    public void showSystemUI() {
        params.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
        _window.setAttributes(params);
    }

    public void translucentNavigation() {
        _window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    }
}
